﻿

namespace Common.Algorithm.Core.LocalTest;

public class AntColonyExecute
{
    static string assemblyPath = Assembly.GetExecutingAssembly().Location;
    static string assemblyDir = Path.GetDirectoryName(assemblyPath) + "\\";

    public static void Run(IEnumerable<GraphEdge> edges)
    {
        AntColonyService antService = new AntColonyService(edges);
        Action action = () =>
        {
            antService.CreateAntGeneration(70);
        };
        Console.WriteLine($"time:{TimeService.TimeWatch(action)}");
        antService.GetBestPath(0);
        Console.WriteLine($"{string.Join("\n", antService.bestPath)}");
    }

    public static void Execute()
    {
        string cityFile = @$"{assemblyDir}\_data_\pr76.txt";
        Run(GraphGenerator.GenCityGraph(cityFile, 70));
    }
}
